package com.example.demo.util;

import com.example.demo.model.enums.ResultCodeEnum;

public class PromotionException extends RuntimeException{
    private int code;

    public PromotionException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public static PromotionException fail(ResultCodeEnum resultCodeEnum) {
        return new PromotionException(resultCodeEnum);
    }

    public int getCode() {
        return code;
    }
}
